package _08递归案例_求和;

/**
 * 求1-n的和
 */
public class Demo {

    public static void main(String[] args) {
        System.out.println(getSum(5));

    }
    public static int getSum(int n){
        if (n ==1){
            return 1;
        }
        return n+getSum(n-1);


    }
}
